package com.lu.pojo.oop.classes;

import java.util.Scanner;

public class test {
    public static void main(String[] args) {
        /*
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.print("姓名:");
            String name = scanner.next();
            System.out.print("年龄:");
            int age = scanner.nextInt();
             if(new Person(name,age).checkOut()==null)
             {
                 System.out.println("门票免费");
             }else{
                 System.out.println("门票20");
             }

        }
        */

        Administrator admin = new Administrator("admin", "123456");
        Scanner scanner = new Scanner(System.in);
        while (true){
            System.out.print("请输入旧密码:");
            // 先检查密码

            String oPwd = scanner.next();
            if(admin.checkPassword(oPwd)){
                System.out.print("请输入新密码:");
                String pwd =scanner.next();
                System.out.print("请输入新密码:");
                String rPwd =scanner.next();

                if (!pwd.equals(rPwd)){
                    System.out.println("两次密码，输入不一致");
                    continue;
                }

                admin.changePassword(oPwd,pwd);
            }else{
                System.out.println("密码不匹配，您没有权限更改！");
            }


        }


    }
}
